import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 * @author CHENTAIWEN
 * @create 2022/9/23 10:30
 */
public class updateName {
    public static final String URL = "jdbc:mysql://localhost:3306/yingz?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&serverTimezone=Asia/Shanghai&useAffectedRows=true";
    public static final String USER = "root";
    public static final String PASSWORD = "root";

    public static void main(String[] args) throws Exception {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
        //拼接查询审核进度
        String sql = "SELECT * from wk_u where value2 is null";
        System.out.println(sql);
        PreparedStatement pst = conn.prepareStatement(sql);
        ResultSet rs = pst.executeQuery();
        List<User> list = new ArrayList();
        while (rs.next()) {
            User user = new User();
            String id = rs.getString("value1");
            String name = rs.getString("name");
            String pid = rs.getString("value2");
            user.setId(id);
            user.setName(name);
            user.setPid(pid);
            list.add(user);

        }
        System.out.println(list);
        System.out.println(list.size());

        conn.close();

        pst.close();
    }
}
